class TplsController < ApplicationController
  # GET /tpl
  # GET /tpl.xml
  def index
    @tpls = Tpl.find(:all)
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @tpl }
    end
  end

  # GET /tpl/1
  # GET /tpl/1.xml
  def show
    @tpl = Tpl.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @tpl }
    end
  end

  # GET /tpl/new
  # GET /tpl/new.xml
  def new
    @tpl = Tpl.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @tpl }
    end
  end

  # GET /tpl/1/edit
  def edit
    @tpl = Tpl.find(params[:id])
  end

  # POST /tpl
  # POST /tpl.xml
  def create
    @tpl = Tpl.new(params[:tpl])

    respond_to do |format|
      if @tpl.save
        flash[:notice] = 'Tpl was successfully created.'
        format.html { redirect_to(@tpl) }
        format.xml  { render :xml => @tpl, :status => :created, :location => @tpl }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @tpl.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /tpl/1
  # PUT /tpl/1.xml
  def update
    @tpl = Tpl.find(params[:id])

    respond_to do |format|
      if @tpl.update_attributes(params[:tpl])
        flash[:notice] = 'Tpl was successfully updated.'
        format.html { redirect_to(@tpl) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @tpl.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /tpl/1
  # DELETE /tpl/1.xml
  def destroy
    @tpl = Tpl.find(params[:id])
    @tpl.destroy

    respond_to do |format|
      format.html { redirect_to(tpl_url) }
      format.xml  { head :ok }
    end
  end
end
